package demo1;

import java.util.Scanner;
import java.util.Set;
import java.util.TreeSet;
public class Main {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        while (input.hasNextLine()) {
            String str1 = input.nextLine();
            String str2 = input.nextLine();
            func(str1,str2);
        }
    }
    public static void func(String str1, String str2) {
        Set<Character> set = new TreeSet<Character>();
        for (int i = 0; i < str2.length(); i++) {
            char ch = str2.charAt(i);
            if (ch >= 'a' && ch <= 'z') {
                ch = (char)(ch - 32);
            }
            if (!set.contains(ch)) {
                set.add(ch);
            }
        }
        String str = "";
        for (int i = 0; i < str1.length(); i++) {
            char ch = str1.charAt(i);
            if (ch >= 'a' && ch <= 'z') {
                ch = (char)(ch - 32);
            }
            if (!set.contains(ch) && !str.contains(ch+"")) {
                str = str + ch;
            }
        }
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < str.length(); i++) {
            char ch = str.charAt(i);
            if (ch >= 'a' && ch <= 'z') {
                sb.append((char)(ch-32) + "");
            } else {
                sb.append(ch+"");
            }
        }
        System.out.println(sb.toString());
    }
}
